<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Setting</title>
<style type="text/css">
body {
	margin:0;
	padding:0;
	font-family:Arial, Helvetica, sans-serif;
	font-size:12px;
	min-width:300px;
}

#settingBox {
	padding:5px;
	background:#E7E7E7;
}

#min {
	width:50px;
}

#copyright {
	text-align:right;
}

#copyright a {
	color:#666;
	text-decoration:none;
}

#copyright a:hover {
	color:#F60;
}

#message {
	color:#F60;
}

</style>
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">

function initSetting () {
	if (localStorage.bkMinVisits) {
		$("#min").val(localStorage.bkMinVisits);
	}
	
	if (localStorage.bkSetAutorun && localStorage.bkSetAutorun == "true") {
		$("#autorun").attr("checked", "checked");
	}
	
}

function saveSetting () {
	
	var min = parseInt($("#min").val());
	
	if (min < 1) {
		alert("请输入正确的最小访问量数值");
	} else {
		localStorage.bkMinVisits = min;
	}
	
	if ($("#autorun").attr("checked") == true) {
		localStorage.bkSetAutorun = "true";
	} else {
		localStorage.bkSetAutorun = "false";
	}
	
	$("#message").html("设置保存成功");
}

$(document).ready(function () {
	initSetting();
	$("#doSave").click(saveSetting);
	$(".links").click(function () {
		chrome.tabs.create({"url":$(this).attr("href")});
	});
});
</script>
</head>

<body>

<div id="settingBox">

<div style="display:none;">
    <p>
    	关键词最小访问量: <input type="text" id="min" name="min" />
    </p>
    
    <p>
    	<label for="autorun">是否自动运行:</label><input type="checkbox" id="autorun" name="autorun" value="1" />
    </p>
    
    <p>
    	<input type="button" id="doSave" value="保存设置" />
    </p>
	<div id="message"></div>
</div>

	<p>
	插件参数配置将会在来来的版本中实现
	</p>

</div>

<div id="copyright">
&copy; 2010 <a href="http://fwso.cn" title="Supported by Fwso.cn" class="links">Fwso.cn</a>. 
	&nbsp;<a href="http://bk-assistant.googlecode.com" class="links">Project Home</a>
</div>

</body>
</html>
